<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:ctl="http://arche.auction.co.kr/WebControl/XmlControl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:s="http://schema.auction.co.kr/Arche.Buy.xsd" xmlns:ms="urn:schemas-microsoft-com:xslt"
	xmlns:ARCHE="http://www.auction.co.kr/xsltFunc" exclude-result-prefixes="ctl s">
	
	<xsl:param name="Result" />
	<xsl:param name="Weekday" />
	<xsl:param name="IsNoTradeMember" />
	<!--
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  Start TEMPLATE
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  -->
<xsl:template match="//*">
	<xsl:if test="$IsNoTradeMember='true'">
		<table cellpadding="0" cellspacing="0">
			<tr>
				<td align="center" bgcolor="white">
					<xsl:call-template name="Chatting">
						<xsl:with-param name="Result" select="$Result" />
						<xsl:with-param name="Weekday" select="$Weekday" />
						<xsl:with-param name="IsNoTradeMember" select="$IsNoTradeMember" />
					</xsl:call-template>
				</td>
			</tr>
		</table>
	</xsl:if>
</xsl:template>
  
<!--
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  Chatting Template
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  -->
	<xsl:template name="Chatting">
	<xsl:param name="Result" />
	<xsl:param name="Weekday" />
	<xsl:param name="IsNoTradeMember" />
	<!-- 토(7),일(1)요일에는 상담을 하지 않습니다. -->
	<xsl:choose>
		<xsl:when test="$Result='3'">  <!--정상-->
			<xsl:choose>
				<xsl:when test="$Weekday!='Sunday' and $Weekday!='Saturday'"><!--주중-->
					<a href="#" onclick="window.open('http://www.auction.co.kr/help/livechat/livechat_main.asp?bodypage=main_category_1.asp?strid={@MemberID}&amp;faqcode={@Code}','chat','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=483,height=573, left=100,top=0');">
					<img src="http://pics.auction.co.kr/buy/chat/c_live_icon.gif" border="0" /></a>
				</xsl:when>
				<xsl:otherwise><!--주말-->
					<a href="#" onclick="window.open('http://www.auction.co.kr/help/livechat/livechat_offhour_help.htm','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=483,height=544,left=100,top=0');"><img src="http://pics.auction.co.kr/buy/chat/c_live_icon_off.gif" border="0" /></a>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:when test="$Result='1'">	<!--업무시간 종료-->
			<a href="#" onclick="window.open('http://www.auction.co.kr/help/livechat/livechat_offhour_help.htm','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=483,height=544,left=100,top=0');"><img src="http://pics.auction.co.kr/buy/chat/c_live_icon_off.gif" border="0" /></a>
		</xsl:when>	
		<xsl:when test="$Result='2'">	<!--전체 대기고객 50명 이상-->
			<a href="#" onclick="window.open('http://www.auction.co.kr/help/livechat/livechat_toomany.htm','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=Yes,copyhistory=0,width=483,height=544, left=100,top=0');"><img src="http://pics.auction.co.kr/buy/chat/c_live_icon_off.gif" border="0" /></a>
		</xsl:when>	
		<xsl:when test="$Result='4'">
			<img src="http://pics.auction.co.kr/buy/chat/c_live_icon_off.gif" border="0" />
		</xsl:when>
	</xsl:choose>
</xsl:template>
  
  <!--
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  XSL SCRIPT 
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  -->
  <ms:script language="JScript" implements-prefix="ARCHE">
<![CDATA[

	function get_formattedDateText( dateValue )
	{
		var dateTime = dateValue.split( "T" );
		var datePart = dateTime[0].split( "-" );		
		var timePart = dateTime[1].substring(0,8).split( ":" );
		var hour = timePart[0];
		
		if (hour < 12)
			hour = "오전 " + hour;
		else if(hour == 12)
			hour = "오후 12";
		else if(hour == 24)
			hour = "오전 00";
		else if(hour > 12)
		{
			hour = timePart[0] - 12;
			hour = "오후 " + hour;
		}

		
		
		return datePart[0] + "-" + datePart[1] + "-" + datePart[2] + "  " + hour + ":" + timePart[1] + ":" + timePart[2];
	}
	
	function GetMethodName(methodCode)
	{
		var methodName = "" ;
		switch(methodCode){
			case "4410":
			methodName	= "일반";
			break;
			
			case "4430":
			methodName	= "공동";
			break;
			
			case "4470":
			methodName	= "고정가";
			break;
			
			case "4471":
			methodName	= "스토어";
			break;
			
			default:
			methodName	= "";		
		
		} 		
		return methodName;
	}
	function GetItemName(itemName)
	{	
		var strName = itemName;
		var i;
		if(itemName.length > 15){
			for( i = 27;i <= 33;i++){
				
				strName = strName.substring(0,i);
				if(strName.length >= 15){
					strName = strName + "..."
					break;
				}  				
			}
			
		}
		
		return strName;
		
		
	}
]]>
</ms:script>
</xsl:stylesheet>
